00001
00009 #include "ndame.h"
00010
00023 void filename(struct data*d1)
00024 {
00025 char cbackslash[4]=":\\";
00026 char cdrive[2];
00027 char ccfilename[100]="ndame.txt";
00028 char ctemp[100];
00029 char cinput;
00030 int iascii;
00031 int icount=0;
00032
00033 gotoxy(2,5);
00034 printf("Select drive (A),(B),(C),(...),(Z)");
00035
00036 do
00037 {
00038 cdrive[0]=getch();
00039 if(islower(cdrive[0]))
00040 {
00041 cdrive[0]=toupper(cdrive[0]);
00042 }
00043 iascii=cdrive[0];
00044 }while(iascii<65||iascii>90);
00045
00046
00047 gotoxy(2,7);
00048 printf("(%s) entered",cdrive);
00049 gotoxy(2,9);
00050 printf("Please enter filename [*.*]");
00051 gotoxy(2,11);
00052 printf("%s:\\",cdrive);
00053
00054 gotoxy(5,11);
00055
00056 do
00057 {
00058 cinput=getch();
00059 if((cinput>=48&&cinput<=57)||(cinput>=65&&cinput<=90)||(cinput>=97&&cinput<=122)||cinput==46||cinput==13||cinput==8||cinput==95||cinput==92)
00060 {
00061 if((strlen(ccfilename)<17)&&(cinput!=8)&&(cinput!=13))
00062 {
00063 putch(cinput);
00064 ccfilename[icount]=cinput;
00065 ccfilename[icount+1]=0;
00066 icount++;
00067 }
00068
00069 if(cinput==8)
00070 {
00071 icount=0;
00072 sprintf(ccfilename,"%s","ndame.txt");
00073 gotoxy(5,11);
00074 printf(" ");
00075 gotoxy(5,11);
00076 }
00077 }
00078
00079 }while(cinput!=13);
00080
00081 strcpy(ctemp,cdrive);
00082 strcat(ctemp,cbackslash);
00083 strcat(ctemp,ccfilename);
00084 strcpy(d1->cfilename,ctemp);
00085
00086
00087
00088
00089 clrbox(0);
00090 state(d1,4);
00091 }